home *** CD-ROM | disk | FTP | other *** search
Visual Basic class definition | 1998-11-02 | 2.0 KB | 75 lines |
- VERSION 1.0 CLASS
- BEGIN
- MultiUse = -1 'True
- Persistable = 0 'NotPersistable
- DataBindingBehavior = 0 'vbNone
- DataSourceBehavior = 0 'vbNone
- MTSTransactionMode = 0 'NotAnMTSObject
- END
- Attribute VB_Name = "CPlane"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = False
- Private m_imgPlane As Image 'image control associated with plane
-
- Property Let imagePlane(newPlane As Image)
- Set m_imgPlane = newPlane
- End Property
-
- Public Function Present() As Boolean
- 'Determine if the plane is visible
- 'Will be needed by the bomb object.
- If m_imgPlane.Visible Then
- Present = True
- Else
- Present = False
- End If
- End Function
-
- Public Function X() As Integer
- X = m_imgPlane.Left
- End Function
-
- Public Function Y() As Integer
- Y = m_imgPlane.Top
- End Function
-
- Public Function W() As Integer
- W = m_imgPlane.Width
- End Function
-
- Public Function H() As Integer
- H = m_imgPlane.Height
- End Function
-
- Public Sub Fly(ByVal dir As String, ByVal Height As Integer, ByVal Width As Integer)
- m_imgPlane.Visible = True
- 'Meanings of variables
- 'dir Direction of airplane (Right, Up, or Down)
- 'Height Height of form
- 'Width Width of form
- If dir = "Up" Then
- 'Prevent airplane from rising off the screen.
- If (m_imgPlane.Top - 500) >= 0 Then
- m_imgPlane.Top = m_imgPlane.Top - 500
- End If
- ElseIf dir = "Down" Then
- 'Prevent airplane from falling off the screen.
- If (m_imgPlane.Top + m_imgPlane.Height + 500) <= Height Then
- m_imgPlane.Top = m_imgPlane.Top + 500
- End If
- ElseIf dir = "Right" Then
- 'Prevent airplane from moving off the screen.
- If (m_imgPlane.Left + m_imgPlane.Width + 500) <= Width Then
- m_imgPlane.Left = m_imgPlane.Left + 500
- End If
- End If
- End Sub
- Public Sub Destroy()
- m_imgPlane.Visible = False
- End Sub
- Private Sub Class_Terminate()
- Set m_imgPlane = Nothing
- End Sub
-